// wglwindow.hpp
//

#ifndef _WGLWINDOW_HPP
#define _WGLWINDOW_HPP

#include "wgl/wglbase.hpp"
#include "wgl/wglapplayer.hpp"

namespace wgl
{
  // WindowSettings
  //
  struct WindowSettings
  {
    int width{640};
    int height{400};
    bool fullscreen{false};
    bool desktop_fullscreen{false};
    bool vsync{true};
  };


  
  // Window
  //
  class WGL_API Window
  {
  public:
    Window ( const WindowSettings &settings,
             bool show=true);
    Window ( int width=640,
             int height=400,
             bool show=true );
    ~Window ();

    bool is_shown () const { return sdl_window != nullptr; }
    Uint32 get_sdl_window_id () const;
    void get_real_size ( int &width,
                         int &height ) const
    { if (is_shown())
        SDL_GetWindowSize(sdl_window, &width, &height);
      else
        width = height = 0;
    }

    bool show ();
    void hide ();
    void make_current ();
    void swap_display ();

  private:
    WindowSettings settings;
    
    SDL_Window *sdl_window{};
    SDL_GLContext gl_context{};
    AppLayerMaster app_layer_master;
    
    void print_gl_infos ();    
  };
}

#endif
